package com.zqxq.lottery.service.user;

import com.baomidou.mybatisplus.service.IService;
import com.zqxq.common.constant.Result;
import com.zqxq.lottery.entity.po.user.UserFundsPO;
import com.zqxq.lottery.entity.po.user.UserInfoPO;
import com.zqxq.lottery.entity.vo.order.UserOrderVO;

import java.math.BigDecimal;
import java.util.Map;


public interface IUserFundsService extends IService<UserFundsPO>{


    /**
     * 充值消费
     * @param userId
     * @param money
     * @param type 1-充值；2-提现；3-奖金；4-竞猜
     * @param payWay 支付方式 0-系统；1-支付宝；2-银行卡；3-奖金；4-余额；5-红包；6-微信；99-其它
     * @param payAccount
     * @param cashId 充值时提交支付宝唯一ID
     */
    boolean saveRechargeOrConsume(Long userId, BigDecimal money, Integer type, Integer payWay, String payAccount, Long cashId);

    boolean saveDrawCash(UserInfoPO userInfoPO, BigDecimal money,  Integer payWay, String payAccount,Long cashId);


    /**
     * 余额消费
     * @param userInfoPO
     * @param money
     * @param orderId
     * @return
     */
    boolean saveBalanceConsume(UserInfoPO userInfoPO, BigDecimal money, Long orderId,Long couponId) throws Exception;

    /**
     * 支付宝消费
     * @param userInfoPO
     * @param money
     * @param orderId
     * @param alipayAccount
     * @return
     * @throws Exception
     */
    boolean saveAlipayConsume(UserInfoPO userInfoPO, BigDecimal money, Long orderId, String alipayAccount, Long couponId, BigDecimal balance) throws Exception;

    boolean saveWechatConsume(UserInfoPO userInfoPO, BigDecimal money, Long orderId, String wechatAccount, Long couponId, BigDecimal balance) throws Exception;

    /**
     * 中奖
     * @param userId
     * @param money
     * @param orderId
     * @return
     */
    boolean saveWinning(Long userId, BigDecimal money, Long orderId) throws Exception;

    boolean saveDrawCashSuccess(Long cashId);
    boolean saveDrawCashFail(Long userId, Long cashId, String failNotes, BigDecimal money);

    Map<String,Object> queryUserFundsByUId(Long userId);

    Result payOrder(UserOrderVO vo,Long couponId);

    Result exchangeDiamonds(Long userId,BigDecimal payAmount);
}
